//
//  JSViewController.m
//  JSToolkit
//
//  Created by 정재성 on 2013. 10. 28..
//  Copyright (c) 2013년 정재성. All rights reserved.
//

#import "JSViewController.h"

#define REUSE_IDENTIFIER @"TestCell"

@interface JSViewController ()

@property (nonatomic) NSArray *testItems;
@property (nonatomic) NSArray *segues;

@end

@implementation JSViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    _testItems = @[@"Alignment Test", @"Popup Test"];
    _segues = @[@"AlignmentTestSegue", @"PopupTestSegue"];
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row < self.segues.count) {
        [self performSegueWithIdentifier:[self.segues objectAtIndex:indexPath.row] sender:self];
    }
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:REUSE_IDENTIFIER forIndexPath:indexPath];
    cell.textLabel.text = [self.testItems objectAtIndex:indexPath.row];
    return cell;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.testItems.count;
}

@end
